<?php 

class Model_MemberGood extends Model{

	function __construct(){

	}
		
	/* 獲得推介報告列表
	* $mid 			int 會員id
	* $sid 			int 被關注的會員id
	* return		array		資料數組
	*/
	function getGoodReport($mid=0,$sid=0){
		if(!intval($mid)) return false;
		$where=" 1 ";
		$where .=" and TB1.section='report'";
		$where .=" and TB1.mid=".intval($mid);
		if(intval($sid)) $where .=" and TB1.sid=".intval($sid);
		
		$param = array();
		$param['field'] = "TB1.mid,TB2.*";
		$param['where'] = $where;
		$param['order'] = $orderby; //"id asc"
		$param['group'] = "";
		$param['limit'] = "";
		$param['pagesize'] =  "";
		$param['page'] = "";
		$param['join'] = "LEFT JOIN product_reports";
		$param['on'] = "TB1.sid = TB2.id";
		$data = db_query_hash('member_good',$param);
		return $data['result'];
	}
}
?>
